package com.example.langchain4jhelloword.controller;

import dev.langchain4j.model.chat.ChatModel;
import dev.langchain4j.model.chat.request.ChatRequestParameters;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author wwl
 * 日期  2025/9/17 17:23
 * 版本 1.0
 * 描述 :
 */
@RestController
public class HelloLangChain4JController {
    @Resource(name = "qwen3")
    private ChatModel chatModel;
    @Resource(name = "mini")
    private ChatModel chatModelDeepSeek;
    @GetMapping("/chatMode/qwen")
    public String qwen(@RequestParam(value ="question",defaultValue = "你是谁?")String question) {
        String result = chatModel.chat(question);
        System.out.println("大模型的回答："+result);
        return result;
    }
    @GetMapping("/chatMode/mini")
    public String mini(@RequestParam(value ="question",defaultValue = "你是谁?")String question) {
        System.out.println("收到请求参数："+ question);
        String result = chatModelDeepSeek.chat(question);
        System.out.println("大模型的回答："+result);
        return result;
    }
}
